package com.jzo2o.api.market;

import com.jzo2o.api.market.dto.request.CouponUseBackReqDTO;
import com.jzo2o.api.market.dto.request.CouponUseReqDTO;
import com.jzo2o.api.market.dto.response.AvailableCouponsResDTO;
import com.jzo2o.api.market.dto.response.CouponUseResDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;

/**
 * 内部接口 - 优惠卷相关接口
 * @author JIAN
 */
@FeignClient(contextId = "jzo2o-market", value = "jzo2o-market", path = "/market/inner/coupon")
public interface CouponApi {
    /**
     * 根据订单金额获取当前用户可用优惠卷
     */
    @GetMapping("/getAvailable")
    List<AvailableCouponsResDTO> getAvailableCoupon(@RequestParam BigDecimal totalAmount);

    /**
     * 用户核销优惠卷返回优惠金额
     */
    @PostMapping("/use")
    CouponUseResDTO useCoupon(@RequestBody CouponUseReqDTO couponUseReqDTO);

    /**
     * 用户取消订单退回使用优惠卷
     */
    @PostMapping("/useBack")
    void useBack(@RequestBody CouponUseBackReqDTO couponUseBackReqDTO);
}